package com.atguigu.lease.common.springmvc;

import com.atguigu.lease.common.result.ResultCodeEnum;
import lombok.Data;

/**
 * projectName: com.atguigu.lease.common.springmvc
 *
 * @author: 赵伟风
 * description:
 */
@Data
public class LeaseException extends RuntimeException{

    private int code; //携带错误码！ result.code = code;

    public LeaseException(String message, int code) {
        super(message);
        this.code = code;
    }

    public LeaseException(ResultCodeEnum resultCodeEnum){
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }
}
